{% extends "admin/models/base.html" %}

{% block main_menu %}
{% endblock %}

{% block custom_bar %}
{% endblock %}

{% block sidebar %}
<h3>最新上架</h3>
<ul id="nav" class="nav nav-list">
		{% for new in new_list %}
			<li><a href="#">{{ new.title|fix_underscores }}</a></li>
		{% endfor %}
</ul>
<br/>
<h3>Top 10</h3>
<ul id="nav" class="nav nav-list">
		{% for top in top_list %}
			<li><a href="#">{{ top.title|fix_underscores }}</a></li>
		{% endfor %}
</ul>
{% endblock %}

{% block content_title %}{% endblock %}

{% block breadcrumb %}
<ul class="breadcrumb">
	<li><span class="divider"></span></li>
</ul>
{% endblock %}

{% block pre_content %}
  <ul class="nav nav-tabs">
    <li class="{% block tab_index_class %}{% endblock %}"><a href="/?{{ request.query_string }}">{{ model_admin.get_display_name()|fix_underscores }} ({{ model_admin.get_query().count() }})</a></li>
	<li class="active"><a href=".">借阅</a></li>
    {% block extra_tabs %}{% endblock %}
  </ul>
{% endblock %}

{% block content %}
  <script type="text/javascript">
    $(function() {
      

      $('form select[data-role="chosen"]').chosen();
      $('.date-widget').datepicker({format: 'yyyy-mm-dd',autoclose: true});
    });
  </script>
  <form action="." class="form-horizontal" method="post">
  	    <input type="hidden" name="id" value="{{ instance.get_id() }}" />
    <fieldset>
      <br/>
      <ul>
          <li>
              <span><a href="#">{{ instance }}</a></span>
          </li>
      </ul>
	 <br/><br/>
	{% from 'macros/forms.html' import with_errors %}
    {% for field in form %}
      <div class="control-group{% if field.errors %} error{% endif %}">
        {{ field.label }}
        <div class="controls">
          {% if field.name=='plan_time' %}
		  	{% set css_class = 'date-widget span8 ' %}
		  {% else %}
          	{% set css_class = 'span8 ' %}
		  {% endif %}
          {% if field.errors %}
            {% set css_class = 'error ' + css_class %}
          {% endif %}
          {{ field(class=css_class) }}
          {% if field.description %}<span class="help-inline">{{ field.description|safe() }}</span>{% endif %}
          {% for error in field.errors %}<span class="help-inline">{{ error }}</span>{% endfor %}
        </div>
      </div>
    {% endfor %}
      <div class="form-actions">
        <button class="btn btn-danger" type="submit">提交</button>&nbsp;&nbsp;
        <a class="btn" href="/?{{ request.query_string }}">取消</a>
      </div>
    </fieldset>
  </form>
{% endblock %}
